package net.monkeybros.sbus.model;

import com.neurospeech.wsclient.*;
import org.w3c.dom.*;

public class InfoSeccion extends WSObject
{
	
	private Integer _seccion;
	public Integer getseccion(){
		return _seccion;
	}
	public void setseccion(Integer value){
		_seccion = value;
	}
	private Integer _longitud;
	public Integer getlongitud(){
		return _longitud;
	}
	public void setlongitud(Integer value){
		_longitud = value;
	}
	private java.util.Vector<InfoNodoSeccion> _nodos = new java.util.Vector<InfoNodoSeccion>();
	public java.util.Vector<InfoNodoSeccion> getnodos(){
		return _nodos;
	}
	public void setnodos(java.util.Vector<InfoNodoSeccion> value){
		_nodos = value;
	}
	
	public static InfoSeccion loadFrom(Element root) throws Exception
	{
		if(root==null){
			return null;
		}
		InfoSeccion result = new InfoSeccion();
		result.load(root);
		return result;
	}
	
	
	protected void load(Element root) throws Exception
	{
		Element child = null;
		NodeList list;
		int i;
		this.setseccion(WSHelper.getInteger(root,"seccion",false));
		this.setlongitud(WSHelper.getInteger(root,"longitud",false));
		child = WSHelper.getElement(root, "nodos");
		if(child != null)
		{
			list = child.getChildNodes();
			for(i=0;i<list.getLength();i++)
			{
				Element nc = (Element)list.item(i);
				_nodos.addElement(InfoNodoSeccion.loadFrom(nc));
			}
		}
	}
	
	
	
	public Element toXMLElement(Element root)
	{
		Element e = root.getOwnerDocument().createElement("InfoSeccion");
		fillXML(e);
		return e;
	}
	
	public void fillXML(Element e)
	{
		WSHelper.addChild(e,"seccion",String.valueOf(_seccion),false);
		WSHelper.addChild(e,"longitud",String.valueOf(_longitud),false);
		if(_nodos!=null)
			WSHelper.addChildArray(e,"nodos",null,_nodos);
	}
	
}
